package com.xiaomili.halfsugar.utils;

import android.content.Context;
import android.graphics.Bitmap.Config;

import com.nostra13.universalimageloader.core.DisplayImageOptions;

/**
 * Created by Administrator on 2016/7/9.
 */
public class UILUtils {
    private   DisplayImageOptions mOptions ;
    private static UILUtils mUIL;
    private Context mContext;

    //私有化构造方法
    private UILUtils (Context context,int fialImage,int emptyImage,int loadingImage){
        this.mContext=context;
        mOptions=new DisplayImageOptions.Builder()
                .cacheOnDisk(true)
                .showImageOnLoading(loadingImage)
                .showImageOnFail(fialImage)
                .showImageForEmptyUri(emptyImage)
                .cacheInMemory(true)
                .bitmapConfig(Config.RGB_565)
                .build();

    }

    public static UILUtils newInstance(Context context,int fialImage,int emptyImage,int loadingImage){
        if(mUIL==null){
            synchronized (UILUtils.class){
                if(mUIL==null){
                    mUIL=new UILUtils(context,fialImage,emptyImage,loadingImage);
                }
            }
        }
        return mUIL;
    }

    public DisplayImageOptions getmOptions(){
        return mOptions;
    }

}
